<template>
	<view class="container">
		<view class="container-info">
			<view class="container-info-box">
				记录时间：
				<span>{{form.eventTime}}</span>
			</view>
		</view>
		<view class="container-info">
			<view class="container-info-box">
				体温：
				<span>{{form.temperature}}</span>
			</view>
		</view>
		<view class="container-info">
			<view class="container-info-box">
				情绪状况：
				<span>{{emotionList[form.emotion - 1].name}}</span>
			</view>
		</view>
		<view class="container-info">
			<view class="container-info-box">
				身体状况：
				<span>{{bodyState[form.bodyState - 1].name}}</span>
			</view>
		</view>
		<view class="container-info">
			<view class="container-info-box" style="display: flex;">
				<view class="remark-lable">备注：</view>
				<textarea v-model="form.remark" rows="3" placeholder="请输入备注"/>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getRecordTemperatureInfo
	} from './api/index.js'
	import recordMixin from './mixins/info.js'
	import {
		formatDateByTimestamp
	} from '@/utils/utils.js'
	export default {
		mixins: [recordMixin],
		data() {
			return {
				form: {
					eventTime: formatDateByTimestamp(Date.now(), 'yyyy/mm/dd hh:MM:ss'),
					temperature: 36.5,
					emotion: 3,
					bodyState: 3,
					remark: '',
				},
				emotionList: [
					{
						name: '不稳定'
					}, 
					{
						name: '哭闹'
					}, 
					{
						name: '平稳'
					},
					{
						name: '愉悦',
					},
					{
						name: '兴奋',
					}
				],
				bodyState: [
					{
						name: '无精打采'
					}, 
					{
						name: '精神不佳'
					}, 
					{
						name: '普通'
					}, 
					{
						name: '精神佳'
					}, 
					{
						name: '精力旺盛'
					}, 
				]
			}
		},
		methods: {
			getRecord() {
				console.log(this.recordId)
				if (this.$u.test.isEmpty(this.recordId)) {
					return;
				}
				uni.showLoading({})
				const params = {
					id: this.recordId,
					childId: this.defaultChildren.id
				}
					getRecordTemperatureInfo(params).then(res => {
						uni.hideLoading()
						const { temperature, emotion, bodyState, remark } = res.data; 
						const eventTime = formatDateByTimestamp(res.data.eventTime, 'yyyy/mm/dd hh:MM:ss')
						const form = {
							eventTime,
							temperature: temperature/10,
							emotion,
							bodyState,
							remark,
						};
						this.form = form
					})

			
			},
		}
	}
</script>

<style lang="scss" scoped>


</style>
